<template>
  <div class="relationship">
    <el-dialog
      :visible.sync="showDialog"
      width="100%"
      top="0"
      :close-on-click-modal="false"
      :lock-scroll="true"
      @close="close"
    >
      <div slot="title">
        <h4>{{form.id ? '编辑家庭成员' : '添加家庭成员'}}</h4>
      </div>
      <el-form ref="form" :model="form" :rules="rules" :inline="true">
        <el-form-item label="成员姓名" prop="name">
          <el-input placeholder="请输入" v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="关系" prop="relationship">
          <el-input placeholder="请输入" v-model="form.relationship"></el-input>
        </el-form-item>
        <el-form-item label="出生年月" prop="birth">
          <el-date-picker
            v-model="form.birth"
            value-format="yyyy-MM-dd"
            format="yyyy-MM-dd"
            type="date"
            placeholder="请选择"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="成员电话" prop="phone">
          <el-input placeholder="请输入" v-model="form.phone"></el-input>
        </el-form-item>
        <el-form-item label="工作单位" prop="work_unit">
          <el-input placeholder="请输入" v-model="form.work_unit"></el-input>
        </el-form-item>
        <el-form-item label="任职职位" prop="positions_held">
          <el-input placeholder="请输入" v-model="form.positions_held"></el-input>
        </el-form-item>

        <el-button style="width: 100%" type="success" @click="finished">保存</el-button>
        <el-button v-if="row.id" style="width: 100%" type="default" @click="del">删除</el-button>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import common from '../mixins/common'

export default {
  name: 'Relationship',
  props: ['isVisible', 'row'],
  mixins: [common],
  data () {
    return {
      uuid: '',
      showDialog: false,
      form: {},
      rules: {},
      editUrl: '/home/relationship/save',
      delUrl: '/home/relationship/del'
    }
  }
}
</script>
